<template>
	<view>
		
		<view class="" v-if="myOrderList">
			<view class="order-container" v-for="(item,index) in myOrderList" :key="index">
				<view class="" v-for="(row ,index) in item.artPointsOrderItems" :key="index">
					<view class="oc-time">{{item.createTime}}</view>
					<view class="oc-nobuy">{{item.orderNo}}</view>
					<view class="oc-content">
						<view class="cc-left">
							<img :src="row.pointsItemVo.image" alt="" style="width: 100%;height: 100%;"/>
						</view>
						<view class="cc-center">
							<view class="c-top">
								{{row.pointsItemVo.name}}
							</view>
							<view class="c-num">
								数量：×{{item.itemSize}}
							</view>
						</view>
						<view class="cc-right">
							<view class="r-top" style="color: green;" v-if="row.status === '0'">已领取</view>
							<view class="r-top"  v-else>未领取</view>
							<view class="r-price">{{item.pointsValue}}积分</view>
						</view>
					</view>
				<view class="oc-space"></view>
				
				</view>
	   <view class="oc-operate">
	   	<view class="co-delete" style="border: 2rpx solid #928c8c;" @click="deleteOrder(item)">
	   		删除订单
	   	</view>
	   </view>
			</view>
		</view>
		<view class="none-shop" v-else>
			暂无订单!
		</view>
	</view>
</template>

<script>
	
	import {getPointsOrderList,deletePointsOrderList} from '@/utils/api.js'
	export default {
		data() {
			return {
				myOrderList:null,
				trainneInfo:uni.getStorageSync('trainneInfo'),
			}
		},
		onLoad() {
			this.getPointsOrderList()
		},
		methods: {
			async getPointsOrderList(){
				uni.showLoading()
				const data = {
					status:'',
					pageSize:9999,
					pageNum:1
				}
				const {code,rows} = await getPointsOrderList(data)
				if(code == 200){
					uni.hideLoading()
				    this.myOrderList = rows
					console.log(this.myOrderList,"this.myOrderListthis.myOrderList");
				}
			 	
			},
		
			async deleteOrder(item){
				uni.showLoading()
				
				const {
					code,
					rows
				} = await deletePointsOrderList(item.id)
				if(code === 200){
				this.getPointsOrderList()
					uni.showToast({
						title: '删除成功',
						icon: 'none'
					})
				}
			},
		}
	}
</script>

<style>
.none-shop{
	text-align: center;
	margin-top: 200rpx;
}
.order-container{
	background-color: #fff;
	width: 93%;
	margin: 30rpx auto;
	padding: 20rpx;
	border-radius: 20rpx;
	position: relative;
}
.oc-time{
	font-weight: bold;
}
.oc-nobuy{
	color: #b7b5b5;
	margin: 20rpx 0;
}
.oc-content{
	display: flex;
}
.cc-left{
	width: 120rpx;
	height: 120rpx;
}
.cc-center{
	margin-left: 20rpx;
}
.c-top{
	font-size: 32rpx;
	font-weight: bold;
}
.c-num{
	color: #b7b5b5;
	margin-top: 38rpx;
}
.cc-right{
	position: absolute;
	right: 20rpx;
}
.r-top{
	color: #f29204;
}
.r-price{
	margin-top: 40rpx;
}
.oc-space{
	width: 100%;
	height: 2rpx;
	background-color: #eae4e4;
	margin: 20rpx 0;
}
.oc-intro{
	text-align: right;
	color: #928c8c;
}
.oc-operate{
	display: flex;
	justify-content: end;
	margin-top: 20rpx ;
}
.co-delete{
	width: 180rpx;
	height: 60rpx;
	text-align: center;
	line-height: 60rpx;
	border-radius: 50rpx;
}
</style>
